import React from 'react'
import format from 'lib/util/format'
import crashNameFormat from '../apis/crashNameFormat'
var config = {
  crash:{
    urlName:BlueWare.platform.toLowerCase()+'_crash_detail_list',
    cols:[{
      title:'崩溃类型',
      key:'crashName',
      width:200,
      formatter:crashNameFormat,
      render:function(fmtVal,rowData){
        return (
          <a href={BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/crashlog#crashtrace/'+rowData.crashNameId}>{fmtVal.reason || fmtVal.type}</a>
        )
      }
    },{
      title:'崩溃发生时间',
      key:'timestamp',
      width:120,
      formatter:format.stampToTime
    },{
      title:'APP版本',
      width:60,
      key:'appVersionName'
    },{
      title:'设备类型',
      key:'modelName'
    },{
      title:'操作系统版本',
      key:'osName',
      render:function(fmtVal,rowData){
        return fmtVal + ' ' + rowData.osVersionName
      }
    }]
  },
  httperror:{
    urlName:'httptrace_detail_list',
    cols:[{
      title:'',
      key:'httpErrorFlag',
      render:function(fmtVal){
        if(fmtVal){
          return (
            <i className="iconfont" style={{color:'#ff0000'}}>&#xe60e;</i>
          )
        }else{
          return null
        }
      }
    },{
      title:'域名',
      key:'domainStr',
      width:100,
      render:function(fmtVal,rowData){
        // if(rowData.httpErrorFlag){
        //   return (
        //     <a href={BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/error#errortrace/'+rowData.id}>{fmtVal}</a>
        //   )
        // }else{
          return fmtVal
        // }
      }
    },{
      title:'时间',
      key:'timestamp',
      width:120,
      formatter:format.stampToTime
    },{
      title:'APP版本',
      width:60,
      key:'appVersionName'
    },{
      title:'地域',
      key:'region'
    },{
      title:'运营商',
      key:'carrier'
    },{
      title:'接入方式',
      key:'netType'
    },{
      title:'HTTP状态码',
      key:'statusCode'
    },{
      title:'操作系统版本',
      key:'osName',
      render:function(fmtVal,rowData){
        return fmtVal + ' ' + rowData.osVersionName
      }
    },{
      title:'设备类型',
      key:'modelName'
    }]
  }
}
config.networkerror = config.httperror
config.httptransaction = config.httperror
export default config
